package com.example.project.manageController;

import com.example.project.dao.ParkingDAO;
import com.example.project.pojo.Parking;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("manage")
public class ManageParkingCheckController {

    @RequestMapping("parkingCheck")
    public String parkingCheck(Model model, Parking parking) {

        ParkingDAO parkingDAO = new ParkingDAO();
        List<Parking> listParking = parkingDAO.AdminCarSelect(parking);
        model.addAttribute("AdminParking", listParking);

        return "/manage/parkingCheck";
    }
    @RequestMapping("deleteParking")
    public String deleteParking(Integer id){
        ParkingDAO parkingDAO =new ParkingDAO();
        parkingDAO.deletParking(id);
        return "redirect:parkingCheck";
    }
}
